package com.test.springtp.controller;


import com.test.springtp.model.CustomerVo;
import com.test.springtp.service.ITbOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ll
 * @since 2025-10-31
 */
@Controller
@RequestMapping("/order")
public class TbOrderController {
    @Autowired
    private ITbOrderService tbOrderService;

    @RequestMapping("/list")
    public String quaryAll(HttpSession session, Model model) {
        List<CustomerVo> customerVos = tbOrderService.queryAll();
        for (CustomerVo customerVo : customerVos) {
            System.out.println(customerVo);
        }
        session.setAttribute("customerVos", customerVos);
        model.addAttribute("c", customerVos);

        return "index";
    }
}
